/*
The MIT License (MIT)

Copyright (c) 2013 Mike Dapiran, Brian May, Richard Pospesel, and Bert Wierenga

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software 
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#pragma once

#include "hhdIContent.h"
#include "hhdHashTable.hpp"

namespace hhd
{
	class TPrefab;
	class GameObject;

	class IGameObjectTreeHolder : public IContent
	{
	public:
		IGameObjectTreeHolder(void);
		virtual ~IGameObjectTreeHolder(void);

		/**
		@param in_path The path to the prefab xml
		@return returns true if the prefab gets loaded, false if it is already loaded by this IGameObjectTreeHolder.
		**/
		bool loadPrefab(const String& in_path);
			
		/**
		Gets an existing prefab and optionally assigns it to a passed in GameObject.
		@param in_key The key associated with the prefab
		@param assign_to The GameObject to assign the prefab to
		@return returns a clone of the prefab with the passed in key, NULL if the key is not present
		**/
		GameObject* getPrefab(const String& in_path, GameObject* write_to = NULL);

		virtual void reset();

	private:
		//a hash table of all prefabs this object will be managing
		//key is the path to the ContentXML
		HashTable< String, SmartPtr<TPrefab> > _path_to_prefabs;
	};
}